<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<div class="project_contents">
	<h1>History</h1>
	<div class="project_in">
		<table id="history_table">
			<tr>
				<th colspan="3"><h2>오늘</h2></th>
			</tr>
			
			<c:forEach items="${historyList }" var="history">
				<c:if test="${history.writeDate.getYear()-100==cal.getCurrentYear()-2000&&
							  history.writeDate.getMonth()==cal.getCurrentMonth()&&
							  history.writeDate.getDate()==cal.getCurrentDay()}">
					<tr>
						<td class="history_icon">
							<c:choose>
								<c:when test="${history.whereNo  == 1}">
									<img src="resources/images/note.png"/>
								</c:when>
								<c:when test="${history.whereNo  == 2}">
									<img src="resources/images/document.png"/>
								</c:when>
								<c:when test="${history.whereNo  == 3}">
									<img src="resources/images/file.png"/>
								</c:when>
							</c:choose>
						</td>
						<td class="history_date"><fmt:formatDate value="${history.writeDate }" pattern="hh:mm:ss" /></td>
						<td><c:choose>
								<c:when test="${history.whereNo  == 1}">
								<span id="span_history_work" onclick="pick_work(${history.workNo})">${history.workType } #${history.workNo } : ${history.workTitle }</span>
							</c:when>
								<c:when test="${history.whereNo  == 2}">
								<span id="span_history_document" onclick="document_pick(${history.docNo})">${history.docTitle }</span>
							</c:when>
								<c:when test="${history.whereNo  == 3}">
								<div class="over-text">
								<a id="span_history_file" href="${history.filePath }">${history.fileName }</a>
								
								</div>
							</c:when>
							</c:choose></td>
					</tr>

				</c:if>
			</c:forEach>
			<tr>
				<th colspan="3"><h2>이전글</h2></th>
			</tr>
			<c:forEach items="${historyList }" var="history">
				<c:if test="${history.writeDate.getDate()!=cal.getCurrentDay()}">
					<tr>
					<td class="history_icon">
						<c:choose>
							<c:when test="${history.whereNo  == 1}">
							<img src="resources/images/note.png"/>
						</c:when>
							<c:when test="${history.whereNo  == 2}">
							<img src="resources/images/document.png"/>
						</c:when>
							<c:when test="${history.whereNo  == 3}">
							<img src="resources/images/file.png"/>
						</c:when>
						</c:choose>
					</td>
					<td class="history_date"><fmt:formatDate value="${history.writeDate }" pattern="YYYY/MM/dd" /></td>
						<td><c:choose>
								<c:when test="${history.whereNo  == 1}">
								<span id="span_history_work" onclick="pick_work(${history.workNo})">${history.workType } #${history.workNo } : ${history.workTitle }</span>
							</c:when>
								<c:when test="${history.whereNo  == 2}">
								<span id="span_history_document" onclick="document_pick(${history.docNo})">${history.docTitle }</span>
							</c:when>
								<c:when test="${history.whereNo  == 3}">
								<div class="over-text">
								<a id="span_history_file" href="${history.filePath }">${history.fileName }</a>
								</div>
							</c:when>
							</c:choose>
						</td>
					</tr>
				</c:if>
			</c:forEach>
		</table>
	</div>
</div>
